package com.qfedu.dao.impl;

import com.qfedu.dao.CategoryDao;
import com.qfedu.model.Category;
import com.qfedu.utils.DruidUtil;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;

import java.util.List;

 class CategoryDaoImpl implements CategoryDao {
    private JdbcTemplate jdbcTemplate = new JdbcTemplate(DruidUtil.getDataSource());
    @Override
    public List<Category> findAll() {
        String sql = "select * from category";
        List<Category> query = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(Category.class));
        return query;
    }


}